import {createRouter, createWebHistory, RouteRecordRaw} from "vue-router";

export const constantRoutes: RouteRecordRaw[] = [
    {
        path: "/",
        component: () => import("@/views/home/index.vue"),
        meta: {
            title: "首页",
        },
    },
    {
        path: "/form",
        component: () => import("@/views/form/index.vue"),
        meta: {
            title: "选择",
        },
    },
    {
        path: "/activity",
        component: () => import("@/views/activity/index.vue"),
        meta: {
            title: "活动",
        },
    },
    {
        path: "/purchased",
        component: () => import("@/views/purchased/index.vue"),
        meta: {
            title: "已购买",
        },
    },
    {
        path: "/login",
        name: "登录",
        component: () => import("@/views/login/index.vue"),
        meta: {
            hidden: true,
        },
    },
    {
        path: "/404",
        component: () => import("@/views/404/index.vue"),
        meta: {
            title: "404",
        },
    },
    { path: "/:catchAll(.*)", redirect: "/404" },
];

const router = createRouter({
    // HTML5 模式路由
    history: createWebHistory(),
    routes: constantRoutes,
});

export default router;
